package com.bdqn.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.bdqn.entity.PsInspectiontaskDetail;
import com.bdqn.entity.PsSystemconfig;
import com.bdqn.service.IPsInspectiontaskDetailService;
import com.bdqn.service.IPsSystemconfigService;

//缺陷类型管理
@RestController
public class BugController {

	@Autowired
	IPsSystemconfigService Ipss;

	@Autowired
	IPsInspectiontaskDetailService Ipsi;

	// 查询缺陷类型
	@GetMapping("bugManage")
	public List<PsSystemconfig> fetch(String configcode) {
		return Ipss.fetch(configcode);
	}

	// 添加缺陷类型
	@GetMapping("bugAdd")
	public int add(String configcode, String configname, int configvalueid, String configvaluename, int isstart,
			String descc) {
		Ipss.add(configcode, configname, configvalueid, configvaluename, isstart, descc);
		return 1;
	}

	// 修改缺陷类型
	@GetMapping("bugUpdate")
	public int update(Long id, String configvaluename) {
		Ipss.update(id, configvaluename);
		return 1;
	}

	// 删除缺陷类型
	@GetMapping("bugDelete")
	public int delete(Long id) {
		Ipss.delete(id);
		return 1;
	}

	// 查询全部缺陷信息
	@GetMapping("bugInfo")
	public List<PsInspectiontaskDetail> fetchBugInfo() {
		return Ipsi.fetchBugInfo();
	}

	// 根据id查询缺陷信息
	@GetMapping("bugInfoById")
	public PsInspectiontaskDetail fetchBugInfoById(Integer id) {
		return Ipsi.fetchBugInfoById(id);
	}

	// 修改缺陷等级
	@GetMapping("bugLevelConfirm")
	public int confirm(Long id, Long bugLevelId) {
		Ipsi.confirm(id, bugLevelId);
		return 1;
	}
}
